package com.example.friend.controller;

import com.example.common.core.domain.R;
import com.example.common.core.domain.TableDataInfo;

import com.example.friend.domain.question.question.dto.QuestionQueryDTO;
import com.example.friend.domain.question.question.vo.QuestionDetailVo;
import com.example.friend.service.IQuestionService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/question")
@Slf4j
public class QuestionController {

    @Autowired
    private IQuestionService questionService;

    @GetMapping("/semiLogin/list")
    public TableDataInfo list(QuestionQueryDTO questionQueryDTO) {
        log.info("/question/list -> QuestionQueryDTO:{}", questionQueryDTO.toString());
        return questionService.list(questionQueryDTO);
    }


    @GetMapping("/detail")
    public R<QuestionDetailVo> getQuestionDeatilById(Long questionId) {
        log.info("/question/detail -> questionId:{}", questionId);
        QuestionDetailVo question = questionService.getQuestionDetailById(questionId);
        return R.ok(question);
    }

}
